<%-- 
    Document   : display
    Created on : Oct 28, 2009, 5:14:19 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*" %>
<%@taglib prefix="ajax" uri="http://ajaxtags.org/tags/ajax" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <jsp:include page="../../header.jsp" />
        <title>JSP Page</title>
    </head>
    <body>
        <%
        int id = Integer.parseInt(request.getParameter("id"));
        %>
        <jsp:useBean id="ObjQuestion" class="DAO.DAOAdmin" scope="request" />
        
        <table border="1">
            <thead>
                <tr>
                    <th>QuestionID</th>
                    <th>SubID</th>
                    <th>ContenQuestion</th>
                    <th>Mark</th>
                    <th>Status</th>
                    <th>Answer</th>
                    <th>Editter</th>
                </tr>
            </thead>
            <%
            ResultSet rss1 = ObjQuestion.selectQuestion2(id);
            while (rss1.next()) {
            
            %>
            <tbody>
                <tr>
                    <td><%=rss1.getString(1)%></td>
                    <td><%=rss1.getString(2)%></td>
                    <td>
                        <ajax:anchors target="displayQuestion" >
                            <a href="addAnswer.jsp?id=<%=rss1.getString(1)%>" ><%=rss1.getString(3)%></a>
                        </ajax:anchors>
                        
                    </td>
                    
                    <td><%=rss1.getString(4)%></td>
                    <td>
                        <a href="include/displayQuestionStatus.jsp?id=<%=rss1.getString(1)%>&<%if (rss1.getBoolean(5) == true) {%>display=false<% } else {%>display=true<% }%>">
                            <%
                            if (rss1.getBoolean(5) == true) {
                            %>
                            <img src="images/preview_f2.png" height="20" width="20" border="0"/>
                            <% } else {
                            %> <img src="images/unpreview_f2.png" height="20" width="20" border="0"/><% } %>
                        </a>
                    </td>
                    <td>
                        <%
                        ResultSet rss2 = ObjQuestion.selectAnswer(rss1.getInt(1));
                        if (rss2.next()) {
                            out.println(rss2.getString("Tong"));
                        }
                        %>
                    </td>
                    <td>
                        <ajax:anchors target="displayQuestion" >
                            <a href="editQuestion.jsp?id=<%=rss1.getString(1)%>&Content=<%=rss1.getString("ContentQuestion")%>&Mark=<%=rss1.getString("Mark")%>" >Edit</a>
                        </ajax:anchors>
                    </td>
                </tr>
            </tbody>
            <% }%>
        </table>
        
        
    </body>
</html>
